import java.util.*;
class Complex
{
    double _a;
    double _b;

    public Complex()
    {
    }
    public Complex(double a,double b)
    {
        _a = a;
        _b = b;
    }
    public double getReal()
    {
        return _a;
    }
    public double getImage()
    {
        return _b;
    }
    public void setRealPart(double a)
    {
        _a = a;
    }
    public void setImaginaryPart(double b)
    {
        _b = b;
    }
    public Complex add(Complex n)
    {
        Complex com = new Complex();

        com._a = _a+n.getReal();
        com._b = _b+n.getImage();

        return com;
    }
    public Complex sub(Complex n)
    {
        Complex com = new Complex();

        com._a = _a-n.getReal();
        com._b = _b-n.getImage();

        return com;
    }

    public String toString()
    {
        if(_a==0&&_b==0)
        {
            return 0 + "";
        }
        if(_a==0)
        {
            return _b+"i";
        }
        if(_b>0)
        {
            return _a+"+"+_b+"i";
        }
        if(_b==0)
        {
            return _a+"";
        }
        return _a+""+_b+"i";
    }
}

public class Main1
{
    public static void main(String[] args)
    {
        Complex a = new Complex();
        Complex b = new Complex();
        Scanner in = new Scanner(System.in);
        a.setRealPart(in.nextDouble());
        a.setImaginaryPart(in.nextDouble());
        b.setRealPart(in.nextDouble());
        b.setImaginaryPart(in.nextDouble());
        System.out.println(a);
        System.out.println(b);
        System.out.println(a.add(b));
        System.out.println(a.sub(b));
    }
}
